#!/bin/bash
#
# Minimal synthesizable BCA subset of SystemC.
#
# Copyright (c) 2008 the handy-eda-utils developer(s).
# Distributed under the MIT License.
# (See accompanying file COPYING or copy at
#  http://www.opensource.org/licenses/mit-license.php.)
#
# cd objdir
# $(SRCDIR)/configure --prefix=/your/installation/directory [--enable-multiclock]
#

srcdir=${0%/*}
prefix=${1#*=}
multiclock=$2

test "$srcdir" != "$0" -a "$prefix" != "$1" -a '(' "$multiclock" == "--enable-multiclock" -o "$multiclock" == "" ')' || {
  echo "usage: \$(SRCDIR)/configure --prefix=PREFIX [--enable-multiclock]"
  exit 2
}

if [ "$multiclock" == "--enable-multiclock" ] ; then
  multiclock=yes
else
  multiclock=no
fi

sed 's|@SRCDIR@|'$srcdir'|;s|@PREFIX@|'$prefix'|;s|@MULTICLOCK@|'$multiclock'|' $srcdir/Makefile.in > Makefile
